# -*- coding: UTF-8 -*-
# filename: yangsy.py
# author by: Face
# 基础题：
list = []
i =2
num = 0

for i in range(2,101):
    for j in range(2,i):
        if i %j ==0:
            break
    else:
        list.append(i)
for x in list:
    if x <10:
        num += x
    else:
        break
s = num **2
print('100以内的质数：',list)
print('小于10的质数平方和为：',s)


# 挑战题：
import requests
# 设置请求头，让网站检测的是浏览器
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'
}
r = requests.get('http://test.rabbitpre.com/',headers= headers)
print(r.encoding)

f = open('rabbit.html','w')
for i in r.text:
    f.write(i)
f.close()

